import request from '@/utils/request';

// 查询简历列表
export function listResume(query) {
  return request({
    url: '/resume/list',
    method: 'get',
    params: query
  });
}

// 获取简历详情
export function getResume(id) {
  return request({
    url: '/resume/' + id,
    method: 'get'
  });
}

// 上传简历
export function uploadResume(data) {
  return request({
    url: '/resume/upload',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}

// 下载简历
export function downloadResume(id) {
  return request({
    url: '/resume/download/' + id,
    method: 'get',
    responseType: 'blob'
  });
}

// 删除简历
export function deleteResume(id) {
  return request({
    url: '/resume/' + id,
    method: 'delete'
  });
}

// 切换收藏状态
export function toggleFavorite(id) {
  return request({
    url: '/resume/favorite/' + id,
    method: 'put'
  });
}

// 分享简历
export function shareResume(data) {
  return request({
    url: '/resume/share',
    method: 'post',
    data: data
  });
}

// 查询学员列表
export function listStudent(query) {
  return request({
    url: '/student/list',
    method: 'get',
    params: query
  });
}

// 查询企业列表
export function listCompany(query) {
  return request({
    url: '/company/list',
    method: 'get',
    params: query
  });
}

// 查询简历版本历史
export function listResumeVersion(resumeId) {
  return request({
    url: '/resume/version/' + resumeId,
    method: 'get'
  });
}

// 恢复简历版本
export function restoreResumeVersion(versionId) {
  return request({
    url: '/resume/restore/' + versionId,
    method: 'put'
  });
}